package com.ly.erms.generator.action.config;

import com.baomidou.mybatisplus.generator.config.rules.DbType;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;

public class ErmsGeneratorConfig extends AbstractGeneratorConfig {

	protected void globalConfig() {
		globalconfig.setOutputDir("d:\\generator\\erms\\src\\main\\java");
		globalconfig.setFileOverride(true);
		globalconfig.setEnableCache(false);
		globalconfig.setBaseResultMap(true);
		globalconfig.setBaseColumnList(true);
		globalconfig.setOpen(false);
		globalconfig.setAuthor("liuyang");
	}

	protected void dataSourceConfig() {
		dataSourceConfig.setDbType(DbType.MYSQL);
		dataSourceConfig.setDriverName("com.mysql.jdbc.Driver");
		dataSourceConfig.setUsername("root");
		dataSourceConfig.setPassword("root");
		dataSourceConfig.setUrl("jdbc:mysql://127.0.0.1:3306/erms?characterEncoding=utf8");
	}

	protected void strategyConfig() {
		// strategyConfig.setTablePrefix(new String[]{"xx_"});// 此处可以修改为您的表前缀
		strategyConfig.setNaming(NamingStrategy.underline_to_camel);
	}

	protected void packageConfig() {
		packageConfig.setParent(null);
		packageConfig.setEntity("com.ly.erms.common.persistence.model");
		packageConfig.setMapper("com.ly.erms.common.persistence.dao");
		packageConfig.setXml("com.ly.erms.common.persistence.dao.mapping");
	}

	protected void contextConfig() {
		contextConfig.setProPackage("com.ly.erms");
		contextConfig.setCoreBasePackage("com.ly.erms.core");
		contextConfig.setBizChName("字典管理");
		contextConfig.setBizEnName("sysDict");
		contextConfig.setModuleName("system");
		contextConfig.setProjectPath("D:\\generator\\erms");// 写自己项目的绝对路径
		contextConfig.setEntityName("SysDict");
		sqlConfig.setParentMenuName(null);// 这里写已有菜单的名称,当做父节点

		/**
		 * mybatis-plus 生成器开关
		 */
		contextConfig.setEntitySwitch(true);
		contextConfig.setDaoSwitch(true);
		contextConfig.setServiceSwitch(true);

		/**
		 * adi 生成器开关
		 */
		contextConfig.setControllerSwitch(true);
		contextConfig.setIndexPageSwitch(true);
		contextConfig.setAddPageSwitch(true);
		contextConfig.setEditPageSwitch(true);
		contextConfig.setJsSwitch(true);
		contextConfig.setInfoJsSwitch(true);
		contextConfig.setSqlSwitch(true);

	}

	@Override
	protected void config() {
		globalConfig();
		dataSourceConfig();
		strategyConfig();
		packageConfig();
		contextConfig();

	}

}
